package a.i.a;

import a.i.n;

class j
{
  private a_[] a;
  private int c;
  private int e;
  
  public j(int paramInt)
  {
    this.a = new a_[paramInt + 2];
    this.c = 0;
    this.e = paramInt;
  }
  
  public a_ a(int paramInt, Object paramObject)
  {
    if (!d.e) {
      if (this.c == this.e)
      {
        this.e += 1024;
        localObject = new a_[this.e + 2];
        System.arraycopy(this.a, 0, localObject, 0, this.a.length);
        this.a = ((a_[])localObject);
      }
    }
    this.c += 1;
    Object localObject = new a_(paramInt, paramObject, this.c);
    a(this.c, (a_)localObject);
    return localObject;
  }
  
  public void a()
  {
    boolean bool2 = d.e;
    boolean bool1 = d.d;
    int i = 1;
    if (i <= this.c) {}
    while (bool2)
    {
      this.a[i] = null;
      i++;
      if ((!bool2) && (bool1)) {
        return;
      }
      if (!bool1) {
        break;
      }
    }
    this.c = 0;
  }
  
  public void a(int paramInt, a_ parama_)
  {
    boolean bool2 = d.e;
    boolean bool1 = d.d;
    this.a[0] = parama_;
    int i = paramInt / 2;
    a_ locala_ = this.a[i];
    if (locala_.a > parama_.a)
    {
      this.a[paramInt] = locala_;
      locala_.c = paramInt;
      paramInt = i;
      i >>= 1;
    }
    do
    {
      locala_ = this.a[i];
      if ((!bool2) && (bool1)) {
        return;
      }
      if (!bool1) {
        break;
      }
      this.a[paramInt] = parama_;
      parama_.c = paramInt;
    } while (bool2);
    this.a[0] = null;
  }
  
  public void c(int paramInt, a_ parama_)
  {
    boolean bool2 = d.e;
    boolean bool1 = d.d;
    int i = paramInt << 1;
    this.a[(this.c + 1)] = this.a[this.c];
    if (i <= this.c) {}
    label117:
    do
    {
      a_ locala_ = this.a[i];
      if ((!bool2) && (bool1)) {
        return;
      }
      if (!bool2) {
        if (i < this.c)
        {
          if (bool2) {
            break label117;
          }
          if (this.a[(i + 1)].a < locala_.a) {
            locala_ = this.a[(++i)];
          }
        }
      }
      if (!bool2)
      {
        if (parama_.a > locala_.a)
        {
          this.a[paramInt] = locala_;
          locala_.c = paramInt;
          paramInt = i;
        }
      }
      else
      {
        i <<= 1;
        if (!bool1) {
          break;
        }
      }
      this.a[paramInt] = parama_;
      parama_.c = paramInt;
    } while (bool2);
    this.a[(this.c + 1)] = null;
  }
  
  public void a(a_ parama_)
  {
    boolean bool = d.e;
    a_ locala_ = this.a[this.c];
    this.a[this.c] = null;
    this.c -= 1;
    if ((bool) || (parama_ != locala_))
    {
      if (!bool)
      {
        if (locala_.a > parama_.a)
        {
          if (bool) {
            break label83;
          }
          c(parama_.c, locala_);
        }
      }
      else if (!d.d) {
        return;
      }
      label83:
      a(parama_.c, locala_);
    }
  }
  
  public void a(a_ parama_, int paramInt)
  {
    parama_.a = paramInt;
    a(parama_.c, parama_);
  }
  
  public void b(a_ parama_, int paramInt)
  {
    parama_.a = paramInt;
    c(parama_.c, parama_);
  }
  
  public void c(a_ parama_, int paramInt)
  {
    boolean bool = d.e;
    if (!bool)
    {
      if (paramInt < parama_.a)
      {
        if (bool) {
          break label35;
        }
        a(parama_, paramInt);
      }
    }
    else if (!d.d) {
      return;
    }
    label35:
    b(parama_, paramInt);
  }
  
  public a_ b()
  {
    return this.a[1];
  }
  
  public boolean c()
  {
    if (!d.e) {}
    return this.c == 0;
  }
  
  public int d()
  {
    return this.c;
  }
  
  public boolean e()
  {
    boolean bool2 = d.e;
    boolean bool1 = d.d;
    do
    {
      for (int i = 2; !bool1; i++)
      {
        if (i > this.c) {
          break;
        }
        if ((!bool2) && (bool1)) {
          break label134;
        }
        if (this.a[i].a < this.a[(i / 2)].a)
        {
          n.a("check failed at " + i);
          n.a("child = " + this.a[i].a + " parent = " + this.a[(i / 2)].a);
          return false;
        }
      }
    } while (bool2);
    label134:
    return true;
  }
  
  private int a(int paramInt)
  {
    if (!d.e) {}
    return this.a[paramInt] == null ? -1 : this.a[paramInt].a;
  }
  
  private Object c(int paramInt)
  {
    if (!d.e) {}
    return this.a[paramInt] == null ? null : this.a[paramInt].b;
  }
  
  static class a_
  {
    int a;
    Object b;
    int c;
    
    a_(int paramInt1, Object paramObject, int paramInt2)
    {
      this.a = paramInt1;
      this.b = paramObject;
      this.c = paramInt2;
    }
  }
}


/* Location:           E:\idea\
 * Qualified Name:     a.i.a.j
 * JD-Core Version:    0.7.0.1
 */